import {
  AllowNull,
  AutoIncrement,
  Column,
  DataType,
  ForeignKey,
  HasMany,
  Model,
  PrimaryKey,
  Table,
} from 'sequelize-typescript';
import { Entry } from './entry.model';
import { Resume } from './resume.model';
@Table({
  tableName: 'content_list',
})
export class Content extends Model {
  @PrimaryKey
  @AutoIncrement
  @Column({
    type: DataType.INTEGER,
    allowNull: false,
    comment: 'content_id',
  })
  id: string;

  @ForeignKey(() => Resume)
  @AllowNull(false)
  @Column({
    type: DataType.INTEGER,
    comment: '',
  })
  resumeId: number;

  //用户id
  @Column({
    type: DataType.INTEGER,
    comment: 'userId',
  })
  userId: number;

  @Column({
    type: DataType.STRING(100),
    comment: '名称',
  })
  displayName: string;

  @Column({
    type: DataType.STRING(50),
    comment: '图标',
  })
  iconKey: string;

  @Column({
    type: DataType.STRING(50),
    comment: '类型',
  })
  sectionType: string;

  @HasMany(() => Entry)
  entries: Entry[];
}
